import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
}

export default new VueRouter({
  mode: 'hash', // 使用hash模式
  routes: [
    {
      path: '/',  // 程序启动默认路由
      component: () => import('@/components/common/Whole.vue'),
      meta: { title: '整体页面布局' },
      redirect: '/Login',  // 重定向到首页
      children: [
        {
          name:'Home',
          path: '/Home',
          component: () => import('@/page/Home.vue'),
          meta: { title: '首页' }
        },
        
        // 基础功能
        {
          name: 'Account',
          path: '/Account',
          component: () => import('@/page/BasicFunctions/Account.vue'),
        },
        {
          name: 'SubAccountManagement',
          path: '/SubAccountManagement',
          component: () => import('@/page/BasicFunctions/SubAccountManagement.vue'),
        },
        {
          name: 'Authority',
          path: '/Authority',
          component: () => import('@/page/BasicFunctions/Authority.vue'),
        },
        {
          name: 'CustomerManagement',
          path: '/CustomerManagement',
          component: () => import('@/page/BasicFunctions/CustomerManagement.vue'),
        },
        {
          name: 'DefaultCustomerPermissions',
          path: '/DefaultCustomerPermissions',
          component: () => import('@/page/BasicFunctions/DefaultCustomerPermissions.vue'),
        },
        {
          name: 'MallManagement',
          path: '/MallManagement',
          component: () => import('@/page/BasicFunctions/MallManagement.vue'),
        },
        {
          name: 'MenuManagement',
          path: '/MenuManagement',
          component: () => import('@/page/BasicFunctions/MenuManagement.vue'),
        },
        {
          name: 'CustomerPriceTag',
          path: '/CustomerPriceTag',
          component: () => import('@/page/BasicFunctions/CustomerPriceTag.vue'),
        },
        {
          name: 'QuoteType',
          path: '/QuoteType',
          component: () => import('@/page/BasicFunctions/QuoteType.vue'),
        },
        {
          name: 'QuotationManagement',
          path: '/QuotationManagement',
          component: () => import('@/page/BasicFunctions/QuotationManagement.vue'),
        },
        
        
        
        // 新闻管理
        {
          name: 'newsCategory',
          path: '/newsCategory',
          component: () => import('@/page/newsManagement/newsCategory.vue'),
        },
        {
          name: 'newsPosition',
          path: '/newsPosition',
          component: () => import('@/page/newsManagement/newsPosition.vue'),
        },
        {
          name: 'videoManagement',
          path: '/videoManagement',
          component: () => import('@/page/newsManagement/videoManagement.vue'),
        },
        {
          name: 'newsManagement',
          path: '/newsManagement',
          component: () => import('@/page/newsManagement/newsManagement.vue'),
        },
        {
          name: 'TeachingManagement',
          path: '/TeachingManagement',
          component: () => import('@/page/newsManagement/TeachingManagement.vue'),
        },

        // 线路管理
        {
          name: 'AddressManagement',
          path: '/AddressManagement',
          component: () => import('@/page/LineManagement/AddressManagement.vue'),
        },
        {
          name: 'AddressLibrary',
          path: '/AddressLibrary',
          component: () => import('@/page/LineManagement/AddressLibrary.vue'),
        },
        {
          name: 'LineManagement',
          path: '/LineManagement',
          component: () => import('@/page/LineManagement/LineManagement.vue'),
        },
        {
          name: 'ThirdPartyFreight',
          path: '/ThirdPartyFreight',
          component: () => import('@/page/LineManagement/ThirdPartyFreight.vue'),
        },
        {
          name: 'FreightManagement',
          path: '/FreightManagement',
          component: () => import('@/page/LineManagement/FreightManagement.vue'),
        },
        {
          name: 'ServiceFeeManagement',
          path: '/ServiceFeeManagement',
          component: () => import('@/page/LineManagement/ServiceFeeManagement.vue'),
        },
        {
          name: 'PartnerManagement',
          path: '/PartnerManagement',
          component: () => import('@/page/LineManagement/PartnerManagement.vue'),
        },
        {
          name: 'ActiveConfiguration',
          path: '/ActiveConfiguration',
          component: () => import('@/page/LineManagement/ActiveConfiguration.vue'),
        },
        {
          name: 'AppConfiguration',
          path: '/AppConfiguration',
          component: () => import('@/page/LineManagement/AppConfiguration.vue'),
        },

        // 订单管理
        // 快递管理
        {
          name: 'ExpressOrderManagement',
          path: '/ExpressOrderManagement',
          component: () => import('@/page/OrderManagement/ExpressDeliveryManagenment/ExpressOrderManagement.vue'),
        },
        {
          name: 'ExpressDeliveryOrderManagement',
          path: '/ExpressDeliveryOrderManagement',
          component: () => import('@/page/OrderManagement/ExpressDeliveryManagenment/ExpressDeliveryOrderManagement.vue'),
        },
        {
          name: 'ExpressDeliveryGoods',
          path: '/ExpressDeliveryGoods',
          component: () => import('@/page/OrderManagement/ExpressDeliveryManagenment/ExpressDeliveryGoods.vue'),
        },
        {
          name: 'ExpressCargoManagement',
          path: '/ExpressCargoManagement',
          component: () => import('@/page/OrderManagement/ExpressDeliveryManagenment/ExpressCargoManagement.vue'),
        },
        {
          name: 'FailedReissueManagement',
          path: '/FailedReissueManagement',
          component: () => import('@/page/OrderManagement/ExpressDeliveryManagenment/FailedReissueManagement.vue'),
        },
        // 快运管理
        {
          name: 'ExpressDeliveryManagement',
          path: '/ExpressDeliveryManagement',
          component: () => import('@/page/OrderManagement/ExpressManagenment/ExpressDeliveryManagement.vue'),
        },
        {
          name: 'WaybillReceiptManagement',
          path: '/WaybillReceiptManagement',
          component: () => import('@/page/OrderManagement/ExpressManagenment/WaybillReceiptManagement.vue'),
        },

        // 快运管理(Delta)
        {
          name: 'ExpressDeliveryManagement_Delta',
          path: '/ExpressDeliveryManagement_Delta',
          component: () => import('@/page/OrderManagement/ExpressManagenment_Delta/ExpressDeliveryManagement.vue'),
        },
        {
          name: 'WaybillReceiptManagement_Delta',
          path: '/WaybillReceiptManagement_Delta',
          component: () => import('@/page/OrderManagement/ExpressManagenment_Delta/WaybillReceiptManagement.vue'),
        },
        {
          name: 'ExpressPackage_Delta',
          path: '/ExpressPackage_Delta',
          component: () => import('@/page/OrderManagement/ExpressManagenment_Delta/ExpressPackage.vue'),
        },
        {
          name: 'ExpressBatch_Delta',
          path: '/ExpressBatch_Delta',
          component: () => import('@/page/OrderManagement/ExpressManagenment_Delta/ExpressBatch.vue'),
        },
        // 账单管理
        {
          name: 'ExpressBillManagement',
          path: '/ExpressBillManagement',
          component: () => import('@/page/OrderManagement/BillManagement/ExpressBillManagement.vue'),
        },
        {
          name: 'TransportBillManagement',
          path: '/TransportBillManagement',
          component: () => import('@/page/OrderManagement/BillManagement/TransportBillManagement.vue'),
        },
        

        //仓库管理
        {
          name: 'WarehouseManagement',
          path: '/WarehouseManagement',
          component: () => import('@/page/storehouse/WarehouseManagement.vue'),
        },
        //货物存放类型管理
        {
          name: 'GoodsStorageTypes',
          path: '/GoodsStorageTypes',
          component: () => import('@/page/storehouse/GoodsStorageTypes.vue'),
        },
        //库区管理
        {
          name: 'ReservoirRegion',
          path: '/ReservoirRegion',
          component: () => import('@/page/storehouse/ReservoirRegion.vue'),
        },
        //货架/货柜管理
        {
          name: 'ShelfContainer',
          path: '/ShelfContainer',
          component: () => import('@/page/storehouse/ShelfContainer.vue'),
        },
        //库存货物管理
        {
          name: 'InventoryGoods',
          path: '/InventoryGoods',
          component: () => import('@/page/storehouse/InventoryGoods.vue'),
        },
        //临时货物管理
        {
          name: 'TemporaryGoods',
          path: '/TemporaryGoods',
          component: () => import('@/page/storehouse/TemporaryGoods.vue'),
        },
        //待上架货物
        {
          name: 'GoodsAwaitingListing',
          path: '/GoodsAwaitingListing',
          component: () => import('@/page/storehouse/GoodsAwaitingListing.vue'),
        },
        //待出货货物
        {
          name: 'GoodsAwaitingShipment',
          path: '/GoodsAwaitingShipment',
          component: () => import('@/page/storehouse/GoodsAwaitingShipment.vue'),
        },
        //货物日志查询
        {
          name: 'QueryCargoLog',
          path: '/QueryCargoLog',
          component: () => import('@/page/storehouse/QueryCargoLog.vue'),
        },


        //接货订单管理 
        {
          name: 'DeliveryOrderManagement',
          path: '/DeliveryOrderManagement',
          component: () => import('@/page/OrderManagement/DeliveryOrderManagement.vue'),
        },
        //出货车单管理
        {
          name: 'ShipmentOrderManagement',
          path: '/ShipmentOrderManagement',
          component: () => import('@/page/OrderManagement/ShipmentOrderManagement.vue'),
        },
        //客户货物查询
        {
          name: 'CustomerGoodsInquiry',
          path: '/CustomerGoodsInquiry',
          component: () => import('@/page/OrderManagement/CustomerGoodsInquiry.vue'),
        },



        




        //货架管理
        {
          name: 'CustomerService',
          path: '/CustomerService',
          component: () => import('@/page/ContactCustomers/CustomerService.vue'),
        },
        {
          name: 'ContactCustomers',
          path: '/ContactCustomers',
          component: () => import('@/page/ContactCustomers/ContactCustomers.vue'),
        },

        //客服管理
        {
          name: 'ShelfManagement',
          path: '/ShelfManagement',
          component: () => import('@/page/warehouse/ShelfManagement/ShelfManagement.vue'),
        },
        {
          name: 'ShelfGoodsManagement',
          path: '/ShelfGoodsManagement',
          component: () => import('@/page/warehouse/ShelfManagement/ShelfGoodsManagement.vue'),
        },
      ]
    },
    {
      name: 'ConsignmentNotePrint',
      path: '/ConsignmentNotePrint',
      component: () => import('@/page/ConsignmentNotePrint.vue'),
      meta: { title: 'ConsignmentNotePrint' }
    },
    {
      name: 'waybillPrinting',
      path: '/waybillPrinting',
      component: () => import('@/page/waybillPrinting.vue'),
      meta: { title: 'waybillPrinting' }
    },
    {
      name: '404',
      path: '/404',
      component: () => import('@/page/404.vue'),
      meta: { title: '404' }
    },
    {
      name: '403',
      path: '/403',
      component: () => import('@/page/403.vue'),
      meta: { title: '403' }
    },
    {
      name:'LoginIndex',
      path: '/Login',  // 登录页面
      component: () => import('@/page/Login.vue'),
      meta: { title: '登录' }
    },
    {
      path: '*',
      redirect: '/404'
    }
  ]
});